# encoding=utf-8
# -*- coding:utf-8 -*-
# Author: wxj0707@163.com

from elasticsearch import Elasticsearch
import sys
import random

reload(sys)
sys.setdefaultencoding('utf-8')

def filtration(str):
	connect = [
		"和","跟","与","既","同","及","而","况","况且","何况","乃",
		"则","乃","就","而","便","于是","然后","至于","说到","此外","像","如","一般","比方","接着",
		"却","虽然","但是","然而","而","偏偏","只是","不过","至于","致","不料","岂知",
		"原来","因为","由于","以便","因此","所以","是故","以致",
		"或","或者","还是","亦","非","即","不是","就是",
		"若","如果","若是","假如","只要","除非","假使","倘若","即使","假若","要是","譬如",
		"像","好比","如同","似乎","等于；不如","不及；与其…不如","若…则","虽然…可是",
		"虽然","固然","尽管","纵然","即使",
		"不但","不仅","而且","何况","并","且",
		"不管","只要","除非",
		"以","以便","以免","为了",
	]

if __name__ == '__main__':

	es = Elasticsearch([{'host':'192.168.2.28','port':9200}])
	res = es.search(index="house", body={"query":{"bool":{"must":[
							  {"query_string":{"default_field":"_all","query":"柔顺"}},
							  {"query_string":{"default_field":"_all","query":"面料"}},
							  {"query_string":{"default_field":"_all","query":"时尚"}}],
					  "must_not":[],"should":[]}},"from":0,"size":5,"sort":[],"aggs":{}})

	content = res['hits']['hits'][0]['_source']['Sentence']
	print "原句：" + content
	arr 	= content.split('，')
	random.shuffle(arr)
	print "现句：" + ','.join(arr)







